上传App Store隐私权限问题导致初审被拒

近期公司项目安全整改,应用内获取系统权限都要报备并说明用途,所以就在info.plist文件中删除了部分没用的权限,下次就不用报备了。今天新版本发布打包成功,上传成功,但是没审核通过。

问题如下

Dear Developer,
We identified one or more issues with a recent delivery for your app, “xxx”. Please correct the following issues, then upload again.
Missing Purpose String in Info.plist File - Your app’s code references one or more APIs that access sensitive user data. The app’s Info.plist file should contain a NSContactsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string. If you’re using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn’t contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

大致意思是应用或SDK用到通讯录API,但是缺少NSContactsUsageDescription权限和描述信息。

如何定位哪里用到了通讯录API及解决审核礼包问题呢?

在代码中删除通讯录依赖库Contancts.frameworkAddressBook.framework,然后运行

1、包含有通讯录API运行后会报错,就可以定位到具体方法及用途。

image.png

在info.plist中添加如下:

1
2
<key>NSContactsUsageDescription</key>
<string>需要您的同意,才能访问通讯录</string>

2、如果删除依赖库运行没有报错,重新打包上传即可

总结

删除隐私权限之前最好提前检查代码中或第三方SDK是否使用到相关API,否则发布升级浪费几次打包时间。